//
//  Config.swift
//  AppUtil
//
//  Created by Vencent on 2020/11/12.
//

import Foundation

public class Config {
    /// App 标识符
    public static var identifier: String = ""
}

extension Config {
    /// 设备 标识符
    public var uuid: String {
        let key = Config.identifier + ".uuid"
        if let uuid = String.init(data: keychain[data: key] ?? Data(), encoding: .utf8) {
            return uuid
        }else {
            let uuid = String.random(ofLength: 32)
            keychain[data: key] = uuid.data(using: .utf8)
            return uuid
        }
    }
}
